VERSION=alpine
NAME=rsyslog
IMAGE_URL=${HARBOR_PROJECT}/${NAME}:${VERSION}

all: build push

build:
	docker build -t ${IMAGE_URL} .

push: build
	docker push ${IMAGE_URL}

image:
	@sed -i "s#image:.*#image: ${IMAGE_URL}#g" ${NAME}-compose.yml

version:
	@echo ${IMAGE_URL}

clean:
	@docker-compose -f ${NAME}-compose.yml down -v
	@rm -rf /swarm/volumes/rsyslog

start:
	@mkdir -p /swarm/volumes/rsyslog
	@docker-compose -f ${NAME}-compose.yml up -d

stop:
	@docker-compose -f ${NAME}-compose.yml stop

logs:
	@docker-compose -f ${NAME}-compose.yml logs -f

.PHONY: all build push
